#Script to Import data to a feature class within a geodatabase
import arcpy, os
try:
    arcpy.env.workspace = "C:/ArcpyBook/Ch7data/Wildfires/WildlandFires.mdb"
    f = open("C:/ArcpyBook/Ch7data/Wildfires/NorthAmericaWildfires_2007275.txt","r")
    lstFires = f.readlines()
    cur = arcpy.InsertCursor("FireIncidents")
    cntr = 1
    for fire in lstFires:
        if 'Latitude' in fire:
            continue
        vals = fire.split(",")
        latitude = float(vals[0])
        longitude = float(vals[1])
        confid = int(vals[2])
        pnt = arcpy.Point(longitude, latitude)
        feat = cur.newRow()
        feat.shape = pnt
        feat.setValue("CONFIDENCEVALUE", confid)
        cur.insertRow(feat)
        arcpy.AddMessage("Record number" + str(cntr) + "written to feature class")
        cntr = cntr + 1
except:
    print arcpy.GetMessages()
finally:
    del cur
    f.close()                     
                         
                
